package com.feihao.zhou.UDP.demo01;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class Demo01 {
    public static void main(String[] args) throws UnknownHostException {
        //参数为主机名
        InetAddress address= InetAddress.getByName("192.168.23.98");

        //获取主机地址
        String hostAddress = address.getHostAddress();
        System.out.println(hostAddress);

        //获取主机名称：
        String hostName = address.getHostName();
        System.out.println(hostName);

        /*InetAddress address = InetAddress.getByName("192.168.23.101");
        System.out.println(address);
        String hostName = address.getHostName();
        System.out.println(hostName);
*/

    }
}
